﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;
using System.Windows;
using System.Windows.Controls;

namespace AlgorithmBox.FlowCharts
{
	public class Decision : FlowChartElement
	{
		public ConnectionLine TrueLink;
		public ConnectionLine TruePrevLink;

		public ConnectionLine FalseLink;
		public ConnectionLine FalsePrevLink;

		public bool CurrentLinkStatus;

		public Decision()
		{
			this.FlowBorder.LayoutTransform = new RotateTransform(45.0);
			this.MinWidth = 100.0;
			this.MinHeight = 100.0;

			this.ContentChanger.Margin = new Thickness(60);
			this.ContentChanger.TextAlignment = TextAlignment.Center;
			this.ContentBlock.TextAlignment = TextAlignment.Center;
		}

		public bool GetLinkStatus()
		{
			this.CurrentLinkStatus = MessageBox.Show("True?", "Result", MessageBoxButton.YesNo) == MessageBoxResult.Yes;
			return this.CurrentLinkStatus;
		}

		public void SetLink(bool result)
		{
			if (result)
			{
				this.Link = this.TrueLink;
				//this.PrevLink = this.TruePrevLink;
			}
			else
			{
				this.Link = this.FalseLink;
				//this.PrevLink = this.FalsePrevLink;
			}
		}
	}
}
